# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=baloo-widgets
pkgver=22.04.3
pkgrel=0
pkgdesc="Widgets for Baloo"
# armhf blocked by extra-cmake-modules
# s390x and riscv64 blocked by polkit -> kio
arch="all !armhf !s390x !riscv64"
url="https://community.kde.org/Baloo"
license="LGPL-2.0-only AND LGPL-2.1-or-later"
depends_dev="
	baloo-dev
	kconfig-dev
	kfilemetadata-dev
	ki18n-dev
	kio-dev
	qt5-qtbase-dev
	samurai
	"
makedepends="$depends_dev extra-cmake-modules"
checkdepends="xvfb-run"
source="https://download.kde.org/stable/release-service/$pkgver/src/baloo-widgets-$pkgver.tar.xz"
subpackages="$pkgname-dev $pkgname-lang"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build
	# filemetadatadatedisplaytest, filemetadatawidgettest and filemetadataitemcounttest
	# require running dbus server
	local skipped_tests="("
	local tests="
		filemetadatadatedisplay
		filemetadatawidget
		filemetadataitemcount"
	for test in $tests; do
		skipped_tests="$skipped_tests|$test"
	done
	skipped_tests="$skipped_tests)|test"
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest -E "$skipped_tests"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}
sha512sums="
c2dd5ed1401e163b26ec6f85284b7eb7a77ffc8c622f70d2d06e6846d91aa9cd00173d035c7ec6053c447dfc4300965047755d6b2d25a6b0efb72ba93e2861bc  baloo-widgets-22.04.3.tar.xz
"
